package com.yc.eduservice.service.impl;

import com.yc.eduservice.mapper.UserCourseMapper;
import com.yc.eduservice.model.entities.UserCourseEntity;
import com.yc.eduservice.service.TeacherService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Resource
    UserCourseMapper userCourseMapper;

    @Override
    public int checkScore(int courseId, int studentId, int userScore) {
        UserCourseEntity userCourseEntity = userCourseMapper.selectByCourseAndStudentId(courseId, studentId);
        if (userCourseEntity == null) {
            return 0;
        }
        return userCourseMapper.checkScore(courseId, studentId, userScore);

    }
}
